package com.bz.controller;

import com.bz.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Controller
@RequestMapping("user")
public class UserController {

    @GetMapping("/findAll")
    public String findAll(HttpServletRequest request, Model model){
        System.out.println("查询所有");

        List<User> list = new ArrayList<>();
        list.add(new User("1","haha",22,new Date()));
        list.add(new User("2","hahadfa",22,new Date()));

        model.addAttribute( "list",list);
        return "/back/index";//相当于跳转试图的逻辑名
    }
}
